<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
/**
 * 通用路由组
 */
Route::group(['namespace' => 'Coms', 'prefix' => 'coms'], function () {
    //后台登录验证码
    Route::get('/admin-code', 'ComsController@adminCode')->name('coms.admin-code');
    //存储后台导航菜单位置信息
    Route::get('/store-menu', 'ComsController@storeMenu')->name('coms.store-menu');

});
Route::group(['namespace' => 'Admin', 'prefix' => 'root'], function () {
    Route::any('/login-act', ['as' => 'admin.login-act', 'uses' => 'LoginController@loginAct']);
    Route::any('/login-exit', 'AdminController@exitAct')->name('admin.login-exit');
    Route::group(['prefix' => 'auth', 'middleware' => ['auth_admin']], function () {
        //获取菜单
        Route::any('/menu', ['as' => 'admin.menu', 'uses' => 'AdminController@getMenu']);
        //管理员
        Route::post('/admins', ['as' => 'admin.admins', 'uses' => 'AdminController@adminsPage']);
        Route::post('/admin-edit', ['as' => 'admin.admins.edit', 'uses' => 'AdminController@adminsEditPage']);
        Route::post('/admins-save', ['as' => 'admin.admins.save', 'uses' => 'AdminController@adminsSave']);
        Route::any('/admins-del', ['as' => 'admin.admins.del', 'uses' => 'AdminController@adminDel']);
        //角色
        Route::any('/roles', ['as' => 'admin.admins.roles', 'uses' => 'AdminController@roles']);
        Route::any('/roles-save', ['as' => 'admin.roles.save', 'uses' => 'AdminController@roles_save']);
        Route::any('/roles-del', ['as' => 'admin.roles.del', 'uses' => 'AdminController@roles_del']);
        Route::any('/roles-edit', ['as' => 'admin.roles.edit', 'uses' => 'AdminController@roles_edit']);
    });
});